import directive from "@/directive";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import { createPinia } from "pinia";
import { createApp } from "vue";
import App from "./App.vue";
import "./index.css";
import router from "./router";
import func from './utils/func.js';
import axios from './utils/http_request.js';

const app = createApp(App)
app.config.globalProperties.$func = func
app.config.globalProperties.$http = axios
//将element-plus的图标注册到app
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const pinia = createPinia();
app.use(ElementPlus, {
    locale: zhCn,
})
app.use(router)
app.use(pinia)
//等待路由初始化完成后再挂载,确保守卫beforeach可以使用pinia
router.isReady().then(() => {
    directive(app)
    app.mount("#app");
})


